<?php 
$data['page_selected'] = 'query';
$this->load->view('constants/header', $data);?>

<script type="text/javascript">
$(function() {
	var availableTags = new Array();
	<?php for($i=0; $i <  count($insts) ; $i++){?>
		availableTags[<?php echo($i); ?>] = {label: "<?php echo($insts[$i]['nombre']);?>",
											 value: "<?php echo($insts[$i]['id_institucion']);?>"};
	<?php } ?>	
	
	$('#tags').autocomplete({
		minLength: 2,
		source: availableTags,
		focus: function(event, ui) {
			$('#tags').val(ui.item.label);
			return false;
		},
		select: function(event, ui) {
			$('#tags').val(ui.item.label);
			$('#inst').val(ui.item.value);				
			return false;
		}
	});
});
</script>
<div id="site_content">
	<?php $this->load->view('constants/sidebar'); ?> 
    <div id="content">
        <!-- insert the page content here -->
	    <?php $this->load->view('query/menu'); ?>
        <br /><br /><br /><br />
  		<h3 align="center">Instituci&oacute;n</h3>
        <h1> Clubes pertenecientes a <?php echo $inst['nombre'] ?> </h1>       
        <table width="100%">
        	<tr>
             	<td align="center">
                    <form method="post" action="<?php echo base_url(); ?>query/get_inst">
                        Buscar&nbsp;
                        <input id="tags" /> <input type="hidden" name="inst" id="inst"/>
                        &nbsp;
                        <input type="image" alt="Submit" src="<?php echo base_url().IMG; ?>search_2.png" width="20px" height="20px" title="Buscar">
                    </form>
		        </td>
        	</tr>
        </table>
        
        <?php if(isset($clubs)){ ?>
           		<table width="100%" align="center">
                    <thead>
                        <th align="center">
                            C&oacute;digo
                        </th>
                        <th align="center">
                            Nombre
                        </th>
                        <th align="center">
                            Email
                        </th>
                    </thead>
                <?php foreach($clubs as $c){ ?>
                    <tr>
                        <td align="center">
                            <?php echo $c['codigo']; ?>
                        </td>
                        <td align="center">
                            <a href="<?php echo base_url(); ?>query/club_info/<?php echo $c['id_club']; ?>">
                                <?php echo $c['nombre']; ?>
                            </a>
                        </td>
                        <td align="center">
                            <?php echo $c['email']; ?>
                        </td>
                    </tr>
                <?php } ?>
                </table>
        <?php } ?>
        
    </div>
</div>
<?php $this->load->view('constants/footer'); ?>